<?php


namespace app\admin\model;
use think\Model;
class Administrators extends Model
{
   // protected $connection="mysql";

    //获取器，把is_enabled变成数组{val,text}
//    public function getIsEnabledAttr($value)
//    {
//        $is_enabled = [0=>'<i class="layui-icon layui-icon-close hese"></i>',1=>'<i class="layui-icon layui-icon-ok olivedrab"></i>'];
//        return ['val' => $value, 'text' => $is_enabled[$value]];
//    }

    //一对一关联
    public function roles() {
        return $this->hasOne(Roles::class,"role_id","role_id")->bind([
            'role_name'	=> 'role_name',
        ]);
    }
}